
public Board(int numberOfMines, int r, int c)
{
    this.rows = r;
    this.cols = c;
    this.numberOfMines = numberOfMines;

    // 确保 cells 数组正确初始化
    cells = new Cell[rows][cols];

    //Step 1: First create a board with empty Cells
    createEmptyCells();         

    //Step 2: Then set mines randomly at cells
    setMines();

    //Step 3: Then set the number of surrounding mines("neighbours") at each cell
    setSurroundingMinesNumber();
}


public void createEmptyCells()
{
    for (int x = 0; x < cols; x++)
    {
        for (int y = 0; y < rows; y++)
        {
            cells[x][y] = new Cell();
        }
    }
}
